﻿/*				Root工具
                by夏天
				版本:3.3.5
*/
#include <iostream>
#include <Windows.h>
#include <cstdlib>
#include <fstream>
#include <conio.h>
#include <direct.h>  
#pragma comment(lib,"URlmon")
using namespace std;
//版本号
string Vera = "3.3.5";
//加密
void encryption(string& c, int a[]) {

	for (int i = 0, j = 0; c[j]; j++, i = (i + 1) % 7) {

		c[j] += a[i];

		if (c[j] > 122) c[j] -= 90;
	}
}
//解密
void decode(string& c, int a[]) {

	for (int i = 0, j = 0; c[j]; j++, i = (i + 1) % 7) {

		c[j] -= a[i];

		if (c[j] < 32) c[j] += 90;
	}
}
//移动指针
void point(int point_x, int point_y)
{
	HANDLE hOut;
	COORD pos = { point_x,point_y };
	hOut = GetStdHandle(STD_OUTPUT_HANDLE);
	SetConsoleCursorPosition(hOut, pos);
}
//清屏
void clear() {
	point(0, 0);
	for (int a = 0; a < 28; a++)
	{
		cout << "                                                                           " << endl;
	}
	point(0, 0);
}
//初始化窗口显示
void Set_Windows() {
	system("mode con:cols=75 lines=29");
	system("color f0");
	system("title 一键root工具");
	auto hStdin = ::GetStdHandle(STD_INPUT_HANDLE);
	DWORD mode;
	::GetConsoleMode(hStdin, &mode);
	mode &= ~ENABLE_QUICK_EDIT_MODE;
	::SetConsoleMode(hStdin, mode);                 //设置文字不能被鼠标选中
	CONSOLE_CURSOR_INFO cursor_info = { 1, 0 };
	SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);            //禁用光标闪烁
}
//验证密钥
void password() {
	repass:
	int a[] = { 4, 9, 6, 2, 8, 7, 3 };
	string password_in, password_real;
	string password_local = "\\c_2<7:5?";
	cout << "请输入密钥:";
	cin >> password_in;
	system("data\\aria2c.exe  >nul");
	ifstream fin("password.data");
	fin >> password_real;
	fin.close();
	system("del password.data >nul");
	decode(password_real, a);
	decode(password_local, a);
	cout << endl;
	if (password_in != password_real || password_in != password_local || password_real!= password_local) {
		cout << endl << "密钥错误,请重新输入..." << endl;
		point(0, 0);
		cout << "                                                                           " << endl;
		point(0, 0);
		goto repass;
	}
	else {
		cout << endl << "密钥正确,即将进入工具..." << endl;
		Sleep(1000);
		clear();
	}
}
//下载adb工具包,解压工具等
void Download_Tools() {
	cout << "正在下载必要文件..." << endl;
	/*
	char magisk[MAX_PATH];
	_getcwd(magisk, MAX_PATH);
	strcat_s(magisk, "//Magisk.zip");
	HRESULT magisk_zip = URLDownloadToFileA(NULL, "https://www.baidu.com", magisk, 0, NULL);
	*/
	char unzip[MAX_PATH];
	_getcwd(unzip, MAX_PATH);
	strcat_s(unzip, "//7z.exe");
	HRESULT zip = URLDownloadToFileA(NULL, "https://www.baidu.com", unzip, 0, NULL);
	char unzip_dll[MAX_PATH];
	_getcwd(unzip_dll, MAX_PATH);
	strcat_s(unzip_dll, "//7z.dll");
	HRESULT zip_dll = URLDownloadToFileA(NULL, "https://www.baidu.com", unzip_dll, 0, NULL);
	cout << "已下载完成7z" << endl;
	char adb[MAX_PATH];
	_getcwd(adb, MAX_PATH);
	strcat_s(adb, "//adb.exe");
	HRESULT ad = URLDownloadToFileA(NULL, "https://www.baidu.com", adb, 0, NULL);
	char fastboot[MAX_PATH];
	_getcwd(fastboot, MAX_PATH);
	strcat_s(fastboot, "//fastboot.exe");
	HRESULT fb = URLDownloadToFileA(NULL, "https://www.baidu.com", fastboot, 0, NULL);
	char adbusb[MAX_PATH];
	_getcwd(adbusb, MAX_PATH);
	strcat_s(adbusb, "//AdbWinUsbApi.dll");
	HRESULT dlla = URLDownloadToFileA(NULL, "https://www.baidu.com", adbusb, 0, NULL);
	char adbapi[MAX_PATH];
	_getcwd(adbapi, MAX_PATH);
	strcat_s(adbapi, "//AdbWinApi.dll");
	HRESULT dllb = URLDownloadToFileA(NULL, "https://www.baidu.com", adbapi, 0, NULL);
	cout << "已下载完成adb工具包" << endl;
	system("taskkill /f /t /im adb.exe");
	//system("move Magisk.zip data\\Magisk.zip");
	system("move 7z.exe data\\7z.exe");
	system("move 7z.dll data\\7z.dll");
	system("move adb.exe data\\adb.exe");
	system("move fastboot.exe data\\fastboot.exe");
	system("move AdbWinUsbApi.dll data\\AdbWinUsbApi.dll");
	system("move AdbWinApi.dll data\\AdbWinApi.dll");
	clear();
}
//新版下载adb工具包,解压工具等
void New_download_tools() {
	cout << "正在下载必要文件..." << endl;
	char unzip[MAX_PATH];
	_getcwd(unzip, MAX_PATH);
	strcat_s(unzip, "//7z.exe");
	HRESULT zip = URLDownloadToFileA(NULL, "https://www.baidu.com", unzip, 0, NULL);
	char unzip_dll[MAX_PATH];
	_getcwd(unzip_dll, MAX_PATH);
	strcat_s(unzip_dll, "//7z.dll");
	HRESULT zip_dll = URLDownloadToFileA(NULL, "https://www.baidu.com", unzip_dll, 0, NULL);
	cout << "已下载完成7z" << endl;
	char adb[MAX_PATH];
	_getcwd(adb, MAX_PATH);
	strcat_s(adb, "//adb_tools.7z");
	HRESULT adbzip = URLDownloadToFileA(NULL, "https://www.baidu.com", adb, 0, NULL);
	system("taskkill /f /t /im adb.exe>nul");
	clear();
	//system("move Magisk.zip data\\Magisk.zip");
	system("move 7z.exe data\\7z.exe");
	clear();
	system("move 7z.dll data\\7z.dll");
	clear();
	system("data\\7z.exe x adb_tools.7z -odata -y");
	clear();
	system("del adb_tools.7z");
	clear();
}
//检测更新
void Update() {
	int a[] = { 4, 9, 6, 2, 8, 7, 3 };
	system("md data");
	system("del root_update.exe");
	clear();
	cout << "正在检测版本更新..." << endl;
	char aria2c[MAX_PATH];
	_getcwd(aria2c, MAX_PATH);
	strcat_s(aria2c, "//aria2c.exe");
	HRESULT download_tools = URLDownloadToFileA(NULL, "https://www.baidu.com", aria2c, 0, NULL);
	cout << "已下载完成aria2c" << endl;
	system("move aria2c.exe data\\aria2c.exe");
	clear();
	cout << "正在检测版本更新..." << endl;
	string Verb;
	system("data\\aria2c.exe https://www.baidu.com >nul");
	ifstream fin("Root_Ver.data");																						//检查版本
	fin >> Verb;
	fin.close();
	decode(Verb, a);
	system("del Root_Ver.data");
	if (Verb != Vera) {
		clear();
		cout << "当前不是最新版本!" << endl << endl << "即将下载最新版..." << endl << endl;
		Sleep(2000);
		system("data\\aria2c.exe -o \"root_update.exe\" https://www.baidu.com >nul");
		cout << "最新版已下载至同目录,名称为root_update" << endl << endl;
		cout << "按任意键退出...";
		system("pause>nul");
		exit(0);
	}
	clear();
}
//安装驱动
void Driver() {
	system("data\\aria2c.exe https://www.baidu.com");
	system("md data\\MiFlash");
	clear();
	system("data\\7z.exe x MiFlash.7z -odata\\MiFlash -y");
	system("del MiFlash.7z");
	system("start data\\MiFlash\\XiaoMiFlash.exe");
	clear();
}
//刷入rec
void Boot_Rec() {
	cout << "请将设备进入Fastboot模式后按下任意键" << endl;
	system("pause>nul");
	system("data\\aria2c.exe https://www.baidu.com");
	clear();
	system("move Magisk_24.1.apk data\\Magisk_24.1.zip");
	clear();
	system("data\\fastboot.exe boot data\\twrp-recovery.img");
	clear();
	cout << "已启动至Recovery模式,请等待开机..." << endl;
	Sleep(10000);
	for (int i = 0; i <= 2; i++) {
		cout << "请手动点击 高级(Advanced)→ADB Sideload→拖动滑块" << endl;
	}
	cout << endl << "准备完成后按任意键继续..." << endl;
	system("pause>nul");
	system("data\\adb.exe sideload data\\Magisk.zip");
	cout << "已刷入Magisk.zip,稍后将重启..." << endl;
	Sleep(2000);
	system("del data\\twrp-recovery.img");
	cout << "刷入完成,如果发现未成功root,请将此页截图发送给开发者!" << endl
		<< "按任意键返回主页面" << endl;
	system("data\\adb.exe reboot >nul");
	system("pause>nul");
	clear();
}
//刷入boot镜像(a/b)
void Flash_Boot() {
	cout << "请将设备进入Fastboot模式后按下任意键" << endl;
	system("pause>nul");
	system("data\\fastboot.exe flash boot_a data\\boot.img");
	cout << "已刷入boot_a分区" << endl << endl;
	system("data\\fastboot.exe flash boot_b data\\boot.img");
	cout << "已刷入boot_b分区" << endl << endl;
	cout << "刷入完成,如果发现未成功root,请将此页截图发送给开发者!" << endl << endl
		<< "需手动安装Magisk,下载地址https://xia040831.xyz" <<  endl << endl
		<< "按任意键返回主页面" << endl;
	system("del data\\boot.img");
	system("data\\fastboot.exe reboot >nul");
	system("pause>nul");
	clear();
}
//刷入boot镜像(onlya)
void Flash_Boot_onlya() {
	cout << "请将设备进入Fastboot模式后按下任意键" << endl;
	system("pause>nul");
	system("data\\fastboot.exe flash boot data\\boot.img");
	cout << "已刷入boot分区" << endl << endl;
	cout << "刷入完成,如果发现未成功root,请将此页截图发送给开发者!" << endl << endl
		<< "需手动安装Magisk,下载地址https://xia040831.xyz" << endl << endl
		<< "按任意键返回主页面" << endl;
	system("del data\\boot.img");
	system("data\\fastboot.exe reboot >nul");
	system("pause>nul");
	clear();
}
//下载更新日志
void Update_Logs() {
	system("data\\aria2c.exe https://www.baidu.com>nul");
	cout << "更新日志已下载至同目录,名称为 更新日志.txt" << endl << endl;
	cout << "按任意键返回主界面...";
	system("pause>nul");
	clear();
}
//版本号加密解密显示
void decode_ver() {
	int a[] = { 4, 9, 6, 2, 8, 7, 3 };
	char aria2c[MAX_PATH];
	_getcwd(aria2c, MAX_PATH);
	strcat_s(aria2c, "//aria2c.exe");
	HRESULT download_tools = URLDownloadToFileA(NULL, "https://www.baidu.com", aria2c, 0, NULL);
	cout << "已下载完成aria2c" << endl;
	system("move aria2c.exe data\\aria2c.exe");
	clear();
	cout << "正在检测版本更新..." << endl;
	string Verb;
	system("data\\aria2c.exe https://www.baidu.com>nul");
	ifstream fin("Root_Ver.data");																						//检查版本
	fin >> Verb;
	fin.close();
	system("del Root_Ver.data");
	cout << "本地未加密版本号为:" << Vera << endl;
	encryption(Vera, a);
	cout << "本地加密过版本号为:" << Vera << endl;
	decode(Vera, a);
	system("pause>nul");
}
int main()
{
	//版本号加密解密显示
	//decode_ver();

	Set_Windows();

	Update();

	password();

	New_download_tools();

	while (true) {
		cout << "机型:" << endl
			<< "1.小米6" << endl
			<< "2.小米9" << endl
			<< "3.小米10S" << endl
			<< "4.小米11" << endl
			<< "5.小米11Pro/Ultra" << endl
			//<< "4.小米11Ultra(未测试)" << endl
			<< "6.红米K40" << endl
			<< "7.小米12X" << endl
			<< "8.小米12" << endl
			<< "9.小米12Pro" << endl
			<< endl << endl
			<< "D.安装驱动(第一次打开先选此项)" << endl
			<< "U.获取更新日志" << endl << endl
			<< "当前版本:" << Vera;
		char option;
		option = _getch();
		clear();
		//小米6
		if (option == '1') {
			clear();
			system("data\\aria2c.exe https://www.baidu.com");
			system("data\\7z.exe x twrp-recovery-sagit.zip -odata -y");
			system("del twrp-recovery-sagit.zip");
			clear();
			cout << "小米6" << endl << endl;
			Boot_Rec();
		}
		//小米9
		if (option == '2') {
		clear();
		int page = 1;
		//添加页码改这里
		int page_max = 1;
		int page_min = 1;
		while (true) {
			char miui_option;
			clear();
			if (page == 1) {
				cout << "小米9" << endl << endl;
				cout << "页码:" << page << endl << endl;
				cout << "MIUI稳定版 版本:" << endl
					<< "1.MIUI 12.5.6" << endl
					<< " " << endl
					<< " " << endl
					<< " " << endl
					<< endl
					<< endl
					<< endl
					<< endl
					<< endl
					<< endl
					<< "N.下一页" << endl
					<< "E.退出" << endl;
				miui_option = _getch();
				clear();
				if (miui_option == '1') {
					clear();
					system("data\\aria2c.exe https://www.baidu.com");
					system("data\\7z.exe x boot_12.5.6.img.zip -odata -y");
					system("del boot_12.5.6.img.zip");
					clear();
					cout << "MIUI 12.5.6" << endl << endl;
					Flash_Boot_onlya();
				}
				if (miui_option == 'n' && page < page_max) {
					page++;
				}
				if (miui_option == 'e') {
					break;
				}
			}
			if (page == 2) {
				cout << "小米9" << endl << endl;
				cout << "页码:" << page << endl << endl;
				cout << "MIUI稳定版 版本:" << endl
					<< endl
					<< endl
					<< endl
					<< endl
					<< endl
					<< endl
					<< endl
					<< endl
					<< endl
					<< endl
					<< "Y.上一页" << endl
					<< "E.退出" << endl;
				miui_option = _getch();
				clear();
				if (miui_option == 'y' && page > page_min) {
					page--;
				}
				if (miui_option == 'e') {
					break;
				}
			}
		}
	}
		//小米10S
		if (option == '3') {
		clear();
		int page = 1;
		//添加页码改这里
		int page_max = 1;
		int page_min = 1;
		while (true) {
			char miui_option;
			clear();
			if (page == 1) {
				cout << "小米10S" << endl << endl;
				cout << "页码:" << page << endl << endl;
				cout << "MIUI稳定版 版本:" << endl
					<< "1.MIUI 12.5.14" << endl
					<< " " << endl
					<< " " << endl
					<< " " << endl
					<< endl
					<< endl
					<< endl
					<< endl
					<< endl
					<< endl
					<< "N.下一页" << endl
					<< "E.退出" << endl;
				miui_option = _getch();
				clear();
				if (miui_option == '1') {
					clear();
					system("data\\aria2c.exe https://www.baidu.com");
					system("data\\7z.exe x boot_12.5.14.img.zip -odata -y");
					system("del boot_12.5.14.img.zip");
					clear();
					cout << "MIUI 12.5.14" << endl << endl;
					Flash_Boot();
				}
				if (miui_option == 'n' && page < page_max) {
					page++;
				}
				if (miui_option == 'e') {
					break;
				}
			}
			if (page == 2) {
				cout << "小米10S" << endl << endl;
				cout << "页码:" << page << endl << endl;
				cout << "MIUI稳定版 版本:" << endl
					<< endl
					<< endl
					<< endl
					<< endl
					<< endl
					<< endl
					<< endl
					<< endl
					<< endl
					<< endl
					<< "Y.上一页" << endl
					<< "E.退出" << endl;
				miui_option = _getch();
				clear();
				if (miui_option == 'y' && page > page_min) {
					page--;
				}
				if (miui_option == 'e') {
					break;
				}
			}
		}
	}
		//小米11
		if (option == '4') {
			clear();
			int page = 1;
			//添加页码改这里
			int page_max = 2;
			int page_min = 1;
			while (true) {
				char miui_option;
				clear();
				if (page == 1) {
					cout << "小米11" << endl << endl;
					cout << "页码:" << page << endl << endl;
					cout << "MIUI稳定版 版本:" << endl
						<< "1.MIUI 12.0.12" << endl
						<< "2.MIUI 12.0.22" << endl
						<< "3.MIUI 12.5.1" << endl
						<< "4.MIUI 12.5.2" << endl
						<< "5.MIUI 12.5.3" << endl
						<< "6.MIUI 12.5.5" << endl
						<< "7.MIUI 12.5.7" << endl
						<< "8.MIUI 12.5.8" << endl
						<< "9.MIUI 12.5.9" << endl
						<< endl
						<< "N.下一页" << endl
						<< "E.退出" << endl;
					miui_option = _getch();
					clear();
					if (miui_option == 'e') {
						break;
					}
					if (miui_option == '1') {
						clear();
						system("data\\aria2c.exe https://www.baidu.com");
						system("data\\7z.exe x boot_12.0.12.img.zip -odata -y");
						system("del boot_12.0.12.img.zip");
						clear();
						cout << "MIUI 12.0.12" << endl << endl;
						Flash_Boot();
					}
					if (miui_option == '2') {
						clear();
						system("data\\aria2c.exe https://www.baidu.com");
						system("data\\7z.exe x boot_12.0.22.img.zip -odata -y");
						system("del boot_12.0.22.img.zip");
						clear();
						cout << "MIUI 12.0.22" << endl << endl;
						Flash_Boot();
						}
					if (miui_option == '3') {
						clear();
						system("data\\aria2c.exe https://www.baidu.com");
						system("data\\7z.exe x boot_12.5.1.img.zip -odata -y");
						system("del boot_12.5.1.img.zip");
						clear();
						cout << "MIUI 12.5.1" << endl << endl;
						Flash_Boot();
						}
					if (miui_option == '4') {
						clear();
						system("data\\aria2c.exe https://www.baidu.com");
						system("data\\7z.exe x boot_12.5.2.img.zip -odata -y");
						system("del boot_12.5.2.img.zip");
						clear();
						cout << "MIUI 12.5.2" << endl << endl;
						Flash_Boot();
					}
					if (miui_option == '5') {
						clear();
						system("data\\aria2c.exe ");
						system("data\\7z.exe x boot_12.5.3.img.zip -odata -y");
						system("del boot_12.5.3.img.zip");
						clear();
						cout << "MIUI 12.5.3" << endl << endl;
						Flash_Boot();
					}
					if (miui_option == '6') {
						clear();
						system("data\\aria2c.exe ");
						system("data\\7z.exe x boot_12.5.5.img.zip -odata -y");
						system("del boot_12.5.5.img.zip");
						clear();
						cout << "MIUI 12.5.5" << endl << endl;
						Flash_Boot();
					}
					if (miui_option == '7') {
						clear();
						system("data\\aria2c.exe ");
						system("data\\7z.exe x boot_12.5.7.img.zip -odata -y");
						system("del boot_12.5.7.img.zip");
						clear();
						cout << "MIUI 12.5.7" << endl << endl;
						Flash_Boot();
					}
					if (miui_option == '8') {
						clear();
						system("data\\aria2c.exe ");
						system("data\\7z.exe x boot_12.5.8.img.zip -odata -y");
						system("del boot_12.5.8.img.zip");
						clear();
						cout << "MIUI 12.5.8" << endl << endl;
						Flash_Boot();
					}
					if (miui_option == '9') {
						clear();
						system("data\\aria2c.exe ");
						system("data\\7z.exe x boot_12.5.9.img.zip -odata -y");
						system("del boot_12.5.9.img.zip");
						clear();
						cout << "MIUI 12.5.9" << endl << endl;
						Flash_Boot();
					}
					if (miui_option == 'n' && page < page_max) {
						page++;
					}
				}
				if (page == 2) {
					cout << "小米11" << endl << endl;
					cout << "页码:" << page << endl << endl;
					cout << "MIUI稳定版 版本:" << endl
						<< "1.MIUI 12.5.10" << endl
						<< "2.MIUI 12.5.11" << endl
						<< "3.MIUI 12.5.12" << endl
						<< "4.MIUI 12.5.13" << endl
						<< "5.MIUI 12.5.15" << endl
						<< "6.MIUI 12.5.16" << endl
						<< "7.MIUI 13.0.4" << endl
						<< "8.MIUI 13.0.5" << endl
						<< "9.MIUI 13.0.6" << endl
						<< endl 
						<< "Y.上一页" << endl
						<< "E.退出" << endl;
					miui_option = _getch();
					clear();
					if (miui_option == 'e') {
						break;
					}
					if (miui_option == '1') {
						clear();
						system("data\\aria2c.exe");
						system("data\\7z.exe x boot_12.5.10.img.zip -odata -y");
						system("del boot_12.5.10.img.zip");
						clear();
						cout << "MIUI 12.5.10" << endl << endl;
						Flash_Boot();
					}
					if (miui_option == '2') {
						clear();
						system("data\\aria2c.exe ");
						system("data\\7z.exe x boot_12.5.11.img.zip -odata -y");
						system("del boot_12.5.11.img.zip");
						clear();
						cout << "MIUI 12.5.11" << endl << endl;
						Flash_Boot();
					}
					if (miui_option == '3') {
						clear();
						system("data\\aria2c.exe ");
						system("data\\7z.exe x boot_12.5.12.img.zip -odata -y");
						system("del boot_12.5.12.img.zip");
						clear();
						cout << "MIUI 12.5.12" << endl << endl;
						Flash_Boot();
					}
					if (miui_option == '4') {
						clear();
						system("data\\aria2c.exe ");
						system("data\\7z.exe x boot_12.5.13.img.zip -odata -y");
						system("del boot_12.5.13.img.zip");
						clear();
						cout << "MIUI 12.5.13" << endl << endl;
						Flash_Boot();
					}
					if (miui_option == '5') {
						clear();
						system("data\\aria2c.exe ");
						system("data\\7z.exe x boot_12.5.15.img.zip -odata -y");
						system("del boot_12.5.15.img.zip");
						clear();
						cout << "MIUI 12.5.15" << endl << endl;
						Flash_Boot();
					}
					if (miui_option == '6') {
						clear();
						system("data\\aria2c.exe ");
						system("data\\7z.exe x boot_12.5.16.img.zip -odata -y");
						system("del boot_12.5.16.img.zip");
						clear();
						cout << "MIUI 12.5.16" << endl << endl;
						Flash_Boot();
					}
					if (miui_option == '7') {
						clear();
						system("data\\aria2c.exe ");
						system("data\\7z.exe x boot_13.0.4.img.zip -odata -y");
						system("del boot_13.0.4.img.zip");
						clear();
						cout << "MIUI 13.0.4" << endl << endl;
						Flash_Boot();
					}
					if (miui_option == '8') {
						clear();
						system("data\\aria2c.exe ");
						system("data\\7z.exe x boot_13.0.5.img.zip -odata -y");
						system("del boot_13.0.5.img.zip");
						clear();
						cout << "MIUI 13.0.5" << endl << endl;
						Flash_Boot();
					}
					if (miui_option == '9') {
						clear();
						system("data\\aria2c.exe ");
						system("data\\7z.exe x boot_13.0.6.img.zip -odata -y");
						system("del boot_13.0.6.img.zip");
						clear();
						cout << "MIUI 13.0.6" << endl << endl;
						Flash_Boot();
					}
					if (miui_option == 'y' && page > page_min) {
						page--;
					}
				}
			}
		}
		//小米11Pro/Ultra
		if (option == '5') {
			clear();
			int page = 1;
			//添加页码改这里
			int page_max = 1;
			int page_min = 1;
			while (true) {
				char miui_option;
				clear();
				if (page == 1) {
					cout << "小米11Pro/Ultra" << endl << endl;
					cout << "页码:" << page << endl << endl;
					cout << "MIUI稳定版 版本:" << endl
						<< "1.MIUI 13.0.5" << endl
						<< "2.MIUI 13.0.9" << endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< "N.下一页" << endl
						<< "E.退出" << endl;
					miui_option = _getch();
					clear();
					if (miui_option == '1') {
						clear();
						system("data\\aria2c.exe ");
						system("data\\7z.exe x boot_13.0.5.img.zip -odata -y");
						system("del boot_13.0.5.img.zip");
						clear();
						cout << "MIUI 13.0.5" << endl << endl;
						Flash_Boot();
					}
					if (miui_option == '2') {
						clear();
						system("data\\aria2c.exe ");
						system("data\\7z.exe x boot_13.0.9.img.zip -odata -y");
						system("del boot_13.0.9.img.zip");
						clear();
						cout << "MIUI 13.0.9" << endl << endl;
						Flash_Boot();
					}
					if (miui_option == 'n' && page < page_max) {
						page++;
					}
					if (miui_option == 'e') {
						break;
					}
				}
				if (page == 2) {
					cout << "小米11Pro/Ultra" << endl << endl;
					cout << "页码:" << page << endl << endl;
					cout << "MIUI稳定版 版本:" << endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< "Y.上一页" << endl
						<< "E.退出" << endl;
					miui_option = _getch();
					clear();
					if (miui_option == 'y' && page > page_min) {
						page--;
					}
					if (miui_option == 'e') {
						break;
					}
				}
			}
		}
		/*
		小米11Ultra
		if (option == '4') {
			system("data\\aria2c.exe");
			system("data\\7z.exe x twrp-recovery-star.zip -odata -y");
			system("del twrp-recovery-star.zip");
			clear();
			cout << "小米11Ultra" << endl << endl;
			Boot_Rec();
		}
		*/
		//红米K40
		if (option == '6') {
			clear();
			system("data\\aria2c.exe ");
			system("data\\7z.exe x twrp-recovery-alioth.zip -odata -y");
			system("del twrp-recovery-alioth.zip");
			clear();
			cout << "红米K40" << endl << endl;
			Boot_Rec();
		}
		//小米12X
		if (option == '7') {
			clear();
			int page = 1;
			//添加页码改这里
			int page_max = 1;
			int page_min = 1;
			while (true) {
				char miui_option;
				clear();
				if (page == 1) {
					cout << "小米12X" << endl << endl;
					cout << "页码:" << page << endl << endl;
					cout << "MIUI稳定版 版本:" << endl
						<< "1.MIUI 13.0.10" << endl
						<< "2.MIUI 13.0.12" << endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< "N.下一页" << endl
						<< "E.退出" << endl;
					miui_option = _getch();
					clear();
					if (miui_option == '1') {
						clear();
						system("data\\aria2c.exe ");
						system("data\\7z.exe x boot_13.0.10.img.zip -odata -y");
						system("del boot_13.0.10.img.zip");
						clear();
						cout << "MIUI 13.0.10" << endl << endl;
						Flash_Boot();
					}
					if (miui_option == '2') {
						clear();
						system("data\\aria2c.exe ");
						system("data\\7z.exe x boot_13.0.12.img.zip -odata -y");
						system("del boot_13.0.12.img.zip");
						clear();
						cout << "MIUI 13.0.12" << endl << endl;
						Flash_Boot();
					}
					if (miui_option == 'n' && page < page_max) {
						page++;
					}
					if (miui_option == 'e') {
						break;
					}
				}
				if (page == 2) {
					cout << "小米12X" << endl << endl;
					cout << "页码:" << page << endl << endl;
					cout << "MIUI稳定版 版本:" << endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< "Y.上一页" << endl
						<< "E.退出" << endl;
					miui_option = _getch();
					clear();
					if (miui_option == 'y' && page > page_min) {
						page--;
					}
					if (miui_option == 'e') {
						break;
					}
				}
			}
		}
		//小米12
		if (option == '8') {
			clear();
			int page = 1;
			//添加页码改这里
			int page_max = 1;
			int page_min = 1;
			while (true) {
				char miui_option;
				clear();
				if (page == 1) {
					cout << "小米12" << endl << endl;
					cout << "页码:" << page << endl << endl;
					cout << "MIUI稳定版 版本:" << endl
						<< "1.MIUI 13.0.12" << endl
						<< "2.MIUI 13.0.16" << endl
						<< "3.MIUI 13.0.21" << endl
						<< "4.MIUI 13.0.23" << endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< "N.下一页" << endl
						<< "E.退出" << endl;
					miui_option = _getch();
					clear();
					if (miui_option == '1') {
						clear();
						system("data\\aria2c.exe ");
						system("data\\7z.exe x boot_13.0.12.img.zip -odata -y");
						system("del boot_13.0.12.img.zip");
						clear();
						cout << "MIUI 13.0.12" << endl << endl;
						Flash_Boot();
					}
					if (miui_option == '2') {
						clear();
						system("data\\aria2c.exe ");
						system("data\\7z.exe x boot_13.0.16.img.zip -odata -y");
						system("del boot_13.0.16.img.zip");
						clear();
						cout << "MIUI 13.0.16" << endl << endl;
						Flash_Boot();
					}
					if (miui_option == '3') {
						clear();
						system("data\\aria2c.exe ");
						system("data\\7z.exe x boot_13.0.21.img.zip -odata -y");
						system("del boot_13.0.21.img.zip");
						clear();
						cout << "MIUI 13.0.21" << endl << endl;
						Flash_Boot();
					}
					if (miui_option == '4') {
						clear();
						system("data\\aria2c.exe ");
						system("data\\7z.exe x boot_13.0.23.img.zip -odata -y");
						system("del boot_13.0.23.img.zip");
						clear();
						cout << "MIUI 13.0.23" << endl << endl;
						Flash_Boot();
					}
					if (miui_option == 'n' && page < page_max) {
						page++;
					}
					if (miui_option == 'e') {
						break;
					}
				}
				if (page == 2) {
					cout << "小米12" << endl << endl;
					cout << "页码:" << page << endl << endl;
					cout << "MIUI稳定版 版本:" << endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< "Y.上一页" << endl
						<< "E.退出" << endl;
					miui_option = _getch();
					clear();
					if (miui_option == 'y' && page > page_min) {
						page--;
					}
					if (miui_option == 'e') {
						break;
					}
				}
			}
		}
		//小米12Pro
		if (option == '9') {
			clear();
			int page = 1;
			//添加页码改这里
			int page_max = 1;
			int page_min = 1;
			while (true) {
				char miui_option;
				clear();
				if (page == 1) {
					cout << "小米12Pro" << endl << endl;
					cout << "页码:" << page << endl << endl;
					cout << "MIUI稳定版 版本:" << endl
						<< "1.MIUI 13.0.12" << endl
						<< "2.MIUI 13.0.16" << endl
						<< "3.MIUI 13.0.21" << endl
						<< "4.MIUI 13.0.23" << endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< "N.下一页" << endl
						<< "E.退出" << endl;
					miui_option = _getch();
					clear();
					if (miui_option == '1') {
						clear();
						system("data\\aria2c.exe ");
						system("data\\7z.exe x boot_13.0.12.img.zip -odata -y");
						system("del boot_13.0.12.img.zip");
						clear();
						cout << "MIUI 13.0.12" << endl << endl;
						Flash_Boot();
					}
					if (miui_option == '2') {
						clear();
						system("data\\aria2c.exe ");
						system("data\\7z.exe x boot_13.0.16.img.zip -odata -y");
						system("del boot_13.0.16.img.zip");
						clear();
						cout << "MIUI 13.0.16" << endl << endl;
						Flash_Boot();
					}
					if (miui_option == '3') {
						clear();
						system("data\\aria2c.exe ");
						system("data\\7z.exe x boot_13.0.21.img.zip -odata -y");
						system("del boot_13.0.21.img.zip");
						clear();
						cout << "MIUI 13.0.21" << endl << endl;
						Flash_Boot();
					}if (miui_option == '4') {
						clear();
						system("data\\aria2c.exe ");
						system("data\\7z.exe x boot_13.0.23.img.zip -odata -y");
						system("del boot_13.0.23.img.zip");
						clear();
						cout << "MIUI 13.0.23" << endl << endl;
						Flash_Boot();
					}
					if (miui_option == 'n' && page < page_max) {
						page++;
					}
					if (miui_option == 'e') {
						break;
					}
				}
				if (page == 2) {
					cout << "小米12Pro" << endl << endl;
					cout << "页码:" << page << endl << endl;
					cout << "MIUI稳定版 版本:" << endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< endl
						<< "Y.上一页" << endl
						<< "E.退出" << endl;
					miui_option = _getch();
					clear();
					if (miui_option == 'y' && page > page_min) {
						page--;
					}
					if (miui_option == 'e') {
						break;
					}
				}
			}
		}
		//驱动
		if (option == 'd') {
			Driver();
		}
		if (option == 'u') {
			Update_Logs();
		}
	}
}
